package com.ctcemti.mdm.project.sys.service.impl;


import com.ctcemti.mdm.project.sys.dao.LoginLogMapper;
import com.ctcemti.mdm.project.sys.entity.LoginLog;
import com.ctcemti.mdm.project.sys.service.ILoginLogService;
import com.ctcemti.mdm.project.tool.generatecode.util.Convert;
import com.ctcemti.mdm.project.tool.generatecode.util.Convert;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 登录日志Service业务层处理
 * 
 * @author 
 * @date Tue Nov 12 14:30:37 CST 2019
 */
@Service
public class LoginLogServiceImpl implements ILoginLogService 
{
    @Autowired
    private LoginLogMapper loginLogMapper;

    @Value("${ctcemti.errorfilepath}")
    private String errorfilepath;
    /**
     * 查询登录日志
     * 
     * @param id 登录日志ID
     * @return 登录日志
     */
    @Override
    public LoginLog selectLoginLogById(Long id)
    {
        return loginLogMapper.selectLoginLogById(id);
    }

    /**
     * 查询登录日志列表
     * 
     * @param loginLog 登录日志
     * @return 登录日志
     */
    @Override
    public PageInfo<LoginLog> selectLoginLogList(LoginLog loginLog)
    {
        PageHelper.startPage(loginLog.getPageIndex(),loginLog.getPageSize(),"tsll.id");
        List<LoginLog> list=loginLogMapper.selectLoginLogList(loginLog);
        PageInfo<LoginLog> pageInfo =  new PageInfo<LoginLog>(list);
        return pageInfo;
    }

    /**
     * 新增登录日志
     * 
     * @param loginLog 登录日志
     * @return 结果
     */
    @Override
    public int insertLoginLog(LoginLog loginLog)
    {
        return loginLogMapper.insertLoginLog(loginLog);
    }

    /**
     * 修改登录日志
     * 
     * @param loginLog 登录日志
     * @return 结果
     */
    @Override
    public int updateLoginLog(LoginLog loginLog)
    {
        return loginLogMapper.updateLoginLog(loginLog);
    }

    /**
     * 删除登录日志对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteLoginLogByIds(String ids)
    {
        return loginLogMapper.deleteLoginLogByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除登录日志信息
     * 
     * @param id 登录日志ID
     * @return 结果
     */
    @Override
    public int deleteLoginLogById(Long id)
    {
        return loginLogMapper.deleteLoginLogById(id);
    }

}
